package com.dc.designPattern._9_facade.impl;

/**
 * Description: 外观模式_家庭立体影院
 * @author: gdc
 * @date: 2021/3/16
 * @version 1.0
 */
public class HomeTheaterFacade {

    /**
     * 定义各个子系统对象
     */
    private DVDPlayer dvdPlayer;
    private Popcorn popcorn;
    private Projector projector;
    private Screen screen;
    private Stereo stereo;
    private TheaterLight theaterLight;

    public HomeTheaterFacade() {
        this.dvdPlayer = DVDPlayer.getInstanc();
        this.popcorn = Popcorn.getInstance();
        this.projector = Projector.getInstance();
        this.screen = Screen.getInstance();
        this.stereo = Stereo.getInstance();
        this.theaterLight = TheaterLight.getInstance();
    }

    /**
     * 准备方法
     */
    public void ready(){
        popcorn.on();
        popcorn.pop();
        screen.down();
        projector.on();
        stereo.on();
        dvdPlayer.on();
        theaterLight.dim();
    }

    /**
     * 播放方法
     */
    public void play(){
        dvdPlayer.play();
    }

    /**
     * 暂停方法
     */
    public void pause(){
        dvdPlayer.pause();
    }

    /**
     * 关闭方法
     */
    public void end() {
        popcorn.off();
        theaterLight.bright();
        screen.up();
        projector.off();
        stereo.off();
        dvdPlayer.off();
    }
}
